package com.own.business.exam.entity.map;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.own.business.exam.entity.po.Exam;
import com.own.component.common.base.entity.BaseMap;
import com.own.component.common.util.DateUtil;
import com.own.constant.ConstantBeanSuffix;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * ExamMapVo
 *
 * @author 陈学礼 （你是一段成熟的代码，要学会自己改bug）
 * @version 4.0.0
 * @date 2021/05/18 14:24:25
 * @since 4.0.0
 */
@ApiModel("考试表" + ConstantBeanSuffix.MAP_VO)
@Getter
@Setter
@ToString
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
public class ExamMapVo extends BaseMap<Exam> {

    @ApiModelProperty("考试标题")
    private String title;

    @ApiModelProperty("开始时间")
    @JsonFormat(pattern = DateUtil.Pattern.DATETIME, timezone = "GMT+8")
    private LocalDateTime startTime;

    @ApiModelProperty("结束时间")
    @JsonFormat(pattern = DateUtil.Pattern.DATETIME, timezone = "GMT+8")
    private LocalDateTime endTime;

    @ApiModelProperty("满分分数")
    private BigDecimal fullScore;

    @ApiModelProperty("是否指定人数 1=指定 0=不指定")
    private Integer isAssignNumber;

    @ApiModelProperty("考试最多容纳的人数 0表示不做限制")
    private Integer assignNumber;

    @ApiModelProperty("是否可以重复作答 1=可以 0=不可以")
    private Integer isRepeat;

    @ApiModelProperty("是否需要自定义分数 1=需要 0=不需要")
    private Integer isCustomerRank;

    @ApiModelProperty("是否直接判题验卷 1=是 0=不是")
    private Integer isDirectJudge;

    @ApiModelProperty("考试时间结束之后是否可以交卷 1=可以 0=不可以")
    private Integer isHandPaperAfterTime;

    @ApiModelProperty("考生查看考试答案的时机 1=交卷之后 2=指定时间 3=无法查看")
    private Integer viewAnswerType;

    @ApiModelProperty("查看试卷答案的时间")
    @JsonFormat(pattern = DateUtil.Pattern.DATETIME, timezone = "GMT+8")
    private LocalDateTime viewAnswerTime;

    @ApiModelProperty("考试类型 1=普通考试 2=实名考试 3=...")
    private Integer type;

    /**
     * 构造方法
     *
     * @param entity 原对象
     */
    public ExamMapVo(@NonNull Exam entity) {
        super(entity);
        this.title = entity.getTitle();
        this.startTime = entity.getStartTime();
        this.endTime = entity.getEndTime();
        this.fullScore = entity.getFullScore();
        this.isAssignNumber = entity.getIsAssignNumber();
        this.assignNumber = entity.getAssignNumber();
        this.isRepeat = entity.getIsRepeat();
        this.isCustomerRank = entity.getIsCustomerRank();
        this.isDirectJudge = entity.getIsDirectJudge();
        this.isHandPaperAfterTime = entity.getIsHandPaperAfterTime();
        this.viewAnswerType = entity.getViewAnswerType();
        this.viewAnswerTime = entity.getViewAnswerTime();
        this.type = entity.getType();
    }
}
